import axios from 'axios'

const http = axios.create({
  baseURL: 'http://localhost:3000',
  timeout: 10000,
  headers: {
    'Content-Type': 'application/json;charset=UTF-8'
    // "Content-Type": "application/x-www-form-urlencoded;charset=utf-8",
  }

})

// http.interceptors.request.use(function (config) {
//   console.log('1111')
//   const token = localStorage.getItem('token')
//   config.headers.Authorization = `Bearer ${token}`
//   return config
// }, function (error) {
//   return Promise.reject(error)
// })

// http.interceptors.response.use(function (response) {
//   const { authorization } = response.headers
//   authorization && localStorage.setItem('token', authorization)
//   return response
// }, function (error) {
//   // const { status } = error.response
//   // if (status === 401) {
//   //   localStorage.removeItem('token')
//   // }
//   return Promise.reject(error)
// })

export default http
